{% extends "base.html" %}
{% block title %}注册{% endblock %}

{% block content %}
<div class="register-container">
    <div class="register-wrapper">
        <div class="register-header">用户注册</div>
        <form method="POST" class="register-form">
            {{ form.hidden_tag() }}
            {% if form.csrf_token %}{{ form.csrf_token }}{% endif %}

            <div class="form-group">
                {{ form.username.label(class="form-label") }}
                {{ form.username(class="register-input", placeholder="请输入用户名") }}
                {% for error in form.username.errors %}
                <div class="error-message">{{ error }}</div>
                {% endfor %}
            </div>

            <div class="form-group">
                {{ form.email.label(class="form-label") }}
                {{ form.email(class="register-input", placeholder="请输入邮箱") }}
                {% for error in form.email.errors %}
                <div class="error-message">{{ error }}</div>
                {% endfor %}
            </div>

            <div class="form-group">
                {{ form.password.label(class="form-label") }}
                {{ form.password(class="register-input", placeholder="请输入密码") }}
                {% for error in form.password.errors %}
                <div class="error-message">{{ error }}</div>
                {% endfor %}
            </div>

            <div class="form-group">
                {{ form.password2.label(class="form-label") }}
                {{ form.password2(class="register-input", placeholder="请确认密码") }}
                {% for error in form.password2.errors %}
                <div class="error-message">{{ error }}</div>
                {% endfor %}
            </div>

            <div class="form-group">
                {{ form.admin_code.label(class="form-label") }}
                {{ form.admin_code(class="form-control", id="admin_code", placeholder="请输入管理员验证码（仅管理员注册需要）") }}
                {% for error in form.admin_code.errors %}
                <div class="error-message">{{ error }}</div>
                {% endfor %}
            </div>

            <button type="submit" class="register-btn">注册</button>

            <div class="register-footer">
                已有账号？<a href="{{ url_for('auth.login') }}">立即登录</a>
            </div>
        </form>
    </div>
</div>

<style>
    /* 原样式保持不变 */
    .register-container {
        height: 100vh;
        background-color: #121212;
        color: #e0e0e0;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 20px;
        background-image: url('https://images.unsplash.com/photo-1506197603052-3cc9c3a201bd?ixlib=rb-1.2.1&auto=format&fit=crop&w=1950&q=80');
        background-size: cover;
        background-position: center;
        background-attachment: fixed;
        position: relative;
    }

    .register-container::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.7);
        z-index: 0;
    }

    .register-wrapper {
        background-color: rgba(30, 30, 30, 0.85);
        width: 100%;
        max-width: 450px;
        padding: 40px;
        border-radius: 10px;
        box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
        z-index: 1;
        backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        transform: translateY(-20px);
        animation: fadeInUp 0.8s ease-out;
    }

    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(30px);
        }
        to {
            opacity: 1;
            transform: translateY(-20px);
        }
    }

    .register-header {
        font-size: 28px;
        font-weight: 600;
        text-align: center;
        margin-bottom: 30px;
        color: #fff;
        letter-spacing: 1px;
        position: relative;
        padding-bottom: 15px;
    }

    .register-header::after {
        content: '';
        position: absolute;
        bottom: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 60px;
        height: 3px;
        background: linear-gradient(to right, #6a11cb, #2575fc);
        border-radius: 3px;
    }

    .form-group {
        margin-bottom: 20px;
    }

    .form-label {
        display: block;
        margin-bottom: 8px;
        font-weight: 500;
        color: #aaa;
    }

    .register-input {
        width: 100%;
        padding: 12px 15px;
        background-color: rgba(255, 255, 255, 0.08);
        border: none;
        border-radius: 5px;
        font-size: 15px;
        color: #e0e0e0;
        transition: all 0.3s ease;
        border-left: 3px solid transparent;
    }

    .register-input:focus {
        outline: none;
        background-color: rgba(255, 255, 255, 0.12);
        border-left: 3px solid #2575fc;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    }

    .register-input::placeholder {
        color: #666;
    }

    .register-btn {
        width: 100%;
        padding: 12px;
        background: linear-gradient(to right, #6a11cb, #2575fc);
        color: white;
        border: none;
        border-radius: 5px;
        font-size: 16px;
        font-weight: 600;
        cursor: pointer;
        transition: all 0.3s ease;
        box-shadow: 0 5px 15px rgba(37, 117, 252, 0.3);
        margin-top: 10px;
    }

    .register-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(37, 117, 252, 0.4);
    }

    .register-footer {
        text-align: center;
        margin-top: 20px;
        color: #aaa;
        font-size: 14px;
    }

    .error-message {
        color: #ff6b6b;
        font-size: 14px;
        margin-top: 5px;
    }

    a {
        color: #6a11cb;
        text-decoration: none;
        transition: color 0.3s ease;
        font-weight: 600;
    }

    a:hover {
        color: #2575fc;
        text-decoration: underline;
    }
</style>
{% endblock %}
